package cn.iocoder.yudao.module.promotion.job.yearcardorder;

import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.promotion.service.yearcardorder.YearCardOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class YearCardOrderExpireJob implements JobHandler {

    @Resource
    private YearCardOrderService yearCardOrderService;

    @Override
    @TenantJob
    public String execute(String param) {
        log.info("开始执行过期年卡订单任务, prams:{}", param);
        int count = yearCardOrderService.expireOrder();
        String result = StrUtil.format("过期年卡订单 {} 个", count);
        log.info("执行过期年卡订单任务结束, result:{}", result);
        return result;
    }
}
